function [ D ] = osl_get_oat_sensordata( oat_results )

% [ D ] = osl_get_oat_sensordata( oat_results )
%
% get D and update path in case OAT dir has been moved

if(isfield(oat_results,'BF'))
    D=oat_results.BF.data.D;
    oatdirname=oat_results.source_recon.dirname;
else,
    D=oat_results.D_sensor_data;
    oatdirname=oat_results.source_recon.dirname;
end;

if(~strcmp([oatdirname],D.path)),        
    D=path(D,[oatdirname]);
    D.save;
    D=spm_eeg_load([D.path '/' D.fname]);
end;

D = osl_correct_meeg_paths(D);




end

